<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <title>登录界面</title>
    <link href="/css/default.css" rel="stylesheet" type="text/css" />
    <!--必要样式-->
    <link href="/css/styles1.css" rel="stylesheet" type="text/css" />
    <link href="/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/css/loaders.css" rel="stylesheet" type="text/css" />


    <link href="    /css/bootstrap.min.css" rel="stylesheet">
    <link href="    /css/font-awesome.css" rel="stylesheet">
    <link href="    /css/datatables.min.css" rel="stylesheet">
    <link href="    /css/animate.css" rel="stylesheet">
    <link href="    /css/style.css" rel="stylesheet">

    <script type="text/javascript" src="/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="/js/vue.js"></script>
    <script src="/js/jquery.metisMenu.js"></script>
    <script src="/js/jquery.slimscroll.min.js"></script>
    <script src="/js/datatables.min.js"></script>
    <script src="/js/inspinia.js"></script>
    <script src="/js/pace.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
</head>

<body>




<div id="myapp">


<div class='login'>
    <div class='login_title'>
        <span>欢迎使用人力资源系统</span>
    </div>
    <div class='login_fields'>
        <div class='login_fields__user'>
            <div class='icon'>
                <img alt="" src=' /img/user_icon_copy.png'>
            </div>
            <input  maxlength="16"  autocomplete="off" type='text'  v-model="admin.sysName"/>
            <div class='validation'>
                <img alt="" src=' /img/tick.png'>
            </div>
        </div>
        <div class='login_fields__password'>
            <div class='icon'>
                <img alt="" src=' /img/lock_icon_copy.png'>
            </div>
            <input  maxlength="16" autocomplete="off" type='password'  v-model="admin.sysPwd">
            <div class='validation'>
                <img alt="" src=' /img/tick.png'>
            </div>
        </div>
        <div class='login_fields__password'>
            <div class='icon'>
                <img alt="" src=' /img/key.png'>
            </div>
            <input id="code" name="code" v-model="admin.code"  maxlength="8" type='text' autocomplete="off" placeholder="验证码">
            <img  id="code_img" alt="" src="/getKaptchaImage" style="float: right; margin-right: 150px; width: 120px;height:40px;">
        </div>
        <div class='login_fields__submit'>
            <input type='button' value='登录' @click="login">
        </div>
    </div>
    <div class='success'>
    </div>
    <div class='disclaimer'>
        <!--打开模态框-->
        <p>没有账户<button style="color: #ff0000;background: none;border: none" type="button" @click="open()">立即注册？</button>&nbsp;&nbsp;&nbsp;<button style="color: #ff0000;background: none;border: none" type="button" @click="openPassword()">忘记密码？</button></p>
    </div>

</div>
<!-- 注册模态框开始 -->
<div id="one" class="modal fade" style="top:200px">
    <div class="modal-dialog">

        <div class="modal-content">
            <!--头部-->
            <div class="modal-header">
                <h4 align="center">注册账号</h4>

            </div>
            <!--主题内容-->
            <div class="modal-body">
                <form role="form" class="form-horizontal">

                    <div class="form-group">
                        <label class=" col-sm-2 control-label">用户名</label>
                        <div class=" col-sm-10">
                            <input type="text" class="form-control" v-model="admin.sysName"  placeholder="请输入用户名">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class=" col-sm-2 control-label">密码</label>
                        <div class=" col-sm-10">
                            <input type="text" class="form-control" v-model="admin.sysPwd"  placeholder="请输入密码">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class=" col-sm-2 control-label">盐值</label>
                        <div class=" col-sm-10">
                            <input type="text" class="form-control" v-model="admin.salt"  placeholder="请输入盐值">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class=" col-sm-2 control-label">邮箱</label>
                        <div class=" col-sm-10">
                            <input type="text" class="form-control" v-model="admin.email"  placeholder="请输入邮箱">
                            <input type="text" v-model="admin.emailCode" placeholder="邮箱验证码"><button  class="btn1" type="button" @click="emailcode()">发送验证码</button>
                        </div>
                    </div>


                </form>
            </div>

            <!--底部-->
            <div class="modal-footer">
                <button class="btn btn-primary btn-sm" type="button" @click="closeWin()"><span class="glyphicon glyphicon-remove"></span>关闭</button>
                <button class="btn btn-primary btn-sm"  type="button" @click="register()"><span class="glyphicon glyphicon-save">注册</span></button>
            </div>

        </div>
    </div>
</div>

    <!-- 修改模态框开始 -->
 <div id="two" class="modal fade" style="top:200px">
        <div class="modal-dialog">

            <div class="modal-content">
                <!--头部-->
                <div class="modal-header">
                    <h4 align="center">修改密码</h4>

                </div>
                <!--主题内容-->
                <div class="modal-body">
                    <form role="form" class="form-horizontal">

                        <div class="form-group">
                            <label class=" col-sm-2 control-label">用户名</label>
                            <div class=" col-sm-10">
                                <input type="text" class="form-control" v-model="admin.sysName"  placeholder="用户名">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class=" col-sm-2 control-label">新密码</label>
                            <div class=" col-sm-10">
                                <input type="password" class="form-control" v-model="admin.sysPwd"  placeholder="请输入新密码">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class=" col-sm-2 control-label">确认密码</label>
                            <div class=" col-sm-10">
                                <input type="password" class="form-control" v-model="admin.surePassword"  placeholder="请输入新密码">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class=" col-sm-2 control-label">注册邮箱</label>
                            <div class=" col-sm-10">
                                <input type="text" class="form-control" v-model="admin.email"  placeholder="请输入注册邮箱">
                                <input type="text" v-model="admin.emailCode" placeholder="邮箱验证码"><button class="btn1" type="button" @click="emailcode()">发送验证码</button>
                            </div>
                        </div>


                    </form>
                </div>

                <!--底部-->
                <div class="modal-footer">
                    <button class="btn btn-primary btn-sm" type="button" @click="closeWin()"><span class="glyphicon glyphicon-remove"></span>关闭</button>
                    <button class="btn btn-primary btn-sm"  type="button" @click="updatePassword()"><span class="glyphicon glyphicon-save">修改</span></button>
                </div>

            </div>
        </div>
    </div>
</div>



<!--=================================================================================================================-->

<div class='authent'>
    <div class="loader" style="height: 44px;width: 44px;margin-left: 28px;">
        <div class="loader-inner ball-clip-rotate-multiple">
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
    <p>认证中...</p>
</div>
<div class="OverWindows"></div>

<link href=" /layui/css/layui.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src=" /js/jquery-ui.min.js"></script>
<script type="text/javascript" src=' /js/stopExecutionOnTimeout.js?t=1'></script>
<script type="text/javascript" src=" /layui/layui.js"></script>
<script type="text/javascript" src=" /js/Particleground.js"></script>
<script type="text/javascript" src="/js/Treatment.js"></script>
<script type="text/javascript" src=" /js/jquery.mockjax.js"></script>

<script type="text/javascript" src=" /img/ThreeWebGL.js"></script>
<script type="text/javascript" src=" /img/ThreeExtras.js"></script>
<script type="text/javascript" src=" /img/Detector.js"></script>
<script type="text/javascript" src=" /img/RequestAnimationFrame.js"></script>
<script id="vs" type="x-shader/x-vertex">
			varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }
		</script>
<script id="fs" type="x-shader/x-fragment">
			uniform sampler2D map; uniform vec3 fogColor; uniform float fogNear; uniform float fogFar; varying vec2 vUv; void main() { float depth = gl_FragCoord.z / gl_FragCoord.w; float fogFactor = smoothstep( fogNear, fogFar, depth ); gl_FragColor = texture2D( map, vUv ); gl_FragColor.w *= pow( gl_FragCoord.z, 20.0 ); gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor ); }

		</script>
<script type="text/javascript">
    if(!Detector.webgl) Detector.addGetWebGLMessage();
    var canvas = document.createElement('canvas');
    canvas.width = 32;
    canvas.height = window.innerHeight;
    var context = canvas.getContext('2d');
    var gradient = context.createLinearGradient(0, 0, 0, canvas.height);
    gradient.addColorStop(0, "#1e4877");
    gradient.addColorStop(0.5, "#4584b4");
    context.fillStyle = gradient;
    context.fillRect(0, 0, canvas.width, canvas.height);
    document.body.style.background = 'url(' + canvas.toDataURL('image/png') + ')';
    var container;
    var camera, scene, renderer, sky, mesh, geometry, material, i, h, color, colors = [],
        sprite, size, x, y, z;
    var mouseX = 0,
        mouseY = 0;
    var start_time = new Date().getTime();
    var windowHalfX = window.innerWidth / 2;
    var windowHalfY = window.innerHeight / 2;
    init();
    animate();

    function init() {
        container = document.createElement('div');
        document.body.appendChild(container);
        camera = new THREE.Camera(30, window.innerWidth / window.innerHeight, 1, 3000);
        camera.position.z = 6000;
        scene = new THREE.Scene();
        geometry = new THREE.Geometry();
        var texture = THREE.ImageUtils.loadTexture('');
        texture.magFilter = THREE.LinearMipMapLinearFilter;
        texture.minFilter = THREE.LinearMipMapLinearFilter;
        var fog = new THREE.Fog(0x4584b4, -100, 3000);
        material = new THREE.MeshShaderMaterial({
            uniforms: {
                "map": {
                    type: "t",
                    value: 2,
                    texture: texture
                },
                "fogColor": {
                    type: "c",
                    value: fog.color
                },
                "fogNear": {
                    type: "f",
                    value: fog.near
                },
                "fogFar": {
                    type: "f",
                    value: fog.far
                },
            },
            vertexShader: document.getElementById('vs').textContent,
            fragmentShader: document.getElementById('fs').textContent,
            depthTest: false
        });
        var plane = new THREE.Mesh(new THREE.Plane(64, 64));
        for(i = 0; i < 8000; i++) {
            plane.position.x = Math.random() * 1000 - 500;
            plane.position.y = -Math.random() * Math.random() * 200 - 15;
            plane.position.z = i;
            plane.rotation.z = Math.random() * Math.PI;
            plane.scale.x = plane.scale.y = Math.random() * Math.random() * 1.5 + 0.5;
            GeometryUtils.merge(geometry, plane)
        }
        mesh = new THREE.Mesh(geometry, material);
        scene.addObject(mesh);
        mesh = new THREE.Mesh(geometry, material);
        mesh.position.z = -8000;
        scene.addObject(mesh);
        renderer = new THREE.WebGLRenderer({
            antialias: false
        });
        renderer.setSize(window.innerWidth, window.innerHeight);
        container.appendChild(renderer.domElement);
        document.addEventListener('mousemove', onDocumentMouseMove, false);
        window.addEventListener('resize', onWindowResize, false)
    }

    function onDocumentMouseMove(event) {
        mouseX = (event.clientX - windowHalfX) * 0.25;
        mouseY = (event.clientY - windowHalfY) * 0.15
    }

    function onWindowResize(event) {
        camera.aspect = window.innerWidth / window.innerHeight;
        camera.updateProjectionMatrix();
        renderer.setSize(window.innerWidth, window.innerHeight)
    }

    function animate() {
        requestAnimationFrame(animate);
        render()
    }

    function render() {
        position = ((new Date().getTime() - start_time) * 0.03) % 8000;
        camera.position.x += (mouseX - camera.target.position.x) * 0.01;
        camera.position.y += (-mouseY - camera.target.position.y) * 0.01;
        camera.position.z = -position + 8000;
        camera.target.position.x = camera.position.x;
        camera.target.position.y = camera.position.y;
        camera.target.position.z = camera.position.z - 1000;
        renderer.render(scene, camera)
    }
</script>



</body>
<!--===============================================================================================================================================-->

<script type="text/javascript">
    new Vue({
        el:"#myapp",
        data:{
            admin:{
                sysName:'root',
                sysPwd:"123",
                salt:"",
                email:"",
                code:"",
                emailCode:"",//前端输入的邮箱验证码
                surePassword:"6666666"//前端修改密码时输入的确认密码
            },

        },
        methods:{
            login:function () {
                var self = this;
                $.ajax({
                    url:"/adminRestful/login",
                    type:"post",
                    contentType:"application/x-www-form-urlencoded",
                    data:self.admin,
                    dataType:"json",
                    success:function (data) {
                        console.log(data);
                        alert(data.info)
                        if(data.info=="登录成功"){
                            window.location.href="/admin/index";
                        }
                    }


                })
            },
            emailcode:function(){
                var self=this;
                $.ajax({
                    url:"/adminRestful/emailCode",
                    type:"post",
                    contentType:"application/x-www-form-urlencoded",
                    data:self.admin,
                    dataType:"json",
                    success:function (data) {
                        alert(data.info)
                    }

                })
            },

            open:function () {
                $("#one").modal("show") //打开模态框
            },

            closeWin:function () {//关闭模态框
                $("#one").modal("hide")
                $("#two").modal("hide")
            },

            register:function () {
                var self=this;
                $.ajax({
                    url:"/registerRestful/register",
                    type:"post",
                    contentType:"application/x-www-form-urlencoded",
                    data:self.admin,
                    dataType:"json",
                    success:function (data) {
                        alert(data.info)
                        self.admin.sysPwd="";
                        self.admin.sysName="";
                    }

                })
            },
            openPassword:function () { //修改密码
                $("#two").modal("show") //打开模态框
            },
            updatePassword:function () {
                var self=this;
                $.ajax({
                    url:"/registerRestful/updatePassword",
                    type:"post",
                    contentType:"application/x-www-form-urlencoded",
                    data:self.admin,
                    dataType:"json",
                    success:function (data) {
                        alert(data.info)
                        self.admin.sysPwd="";
                        self.admin.sysName="";
                    }

                })
            }

        }

    });


       //给验证码的图片，绑定单击事件
       $("#code_img").click(function () {
           //在响应的function函数中有一个this对象。这个this对象，是当前正在响应事件的dom对象
           //src属性表示验证码img标签的 图片路径。可读  可写
           this.src="/getKaptchaImage?d="+new Date();
       });



    var time = 60;
    var flag = true;
    $('.btn1').click(function(){
        $(this).attr("disabled",true);
        if(flag){
            var timer = setInterval(function () {
                flag = false;
                if(time == 0){
                    $(".btn1").removeAttr("disabled");
                    $(".btn1").html("免费获取验证码");
                    clearInterval(timer);
                    time = 60;
                    flag = true;
                }else {
                    $(".btn1").html(time + " s 重新发送");
                    time--;
                }
            },1000);
        }

    });

</script>
</html>